From e71b7e9054edb527f78ea2d91328b3b53e9e7eb6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Wed, 26 Jan 2022 04:38:53 +0100 Subject: [PATCH] new symbol babl_fish_get_process This permits some APIs to avoid a function call per dispatch, specifically the samplers in GeglBuffer. --- babl/babl-fish.c | 6 ++++++ babl/babl.h | 11 +++++++++++ export-symbols | 1 + 3 files changed, 18 insertions(+) diff --git a/babl/babl-fish.c b/babl/babl-fish.c index ce22b6b..aece33b 100644 --- a/babl/babl-fish.c +++ b/babl/babl-fish.c @@ -359,4 +359,10 @@ babl_fish (const void *source, } } + +BablFishProcess babl_fish_get_process (const Babl *babl) +{ + return babl->fish.dispatch; +} + BABL_CLASS_MINIMAL_IMPLEMENT (fish); diff --git a/babl/babl.h b/babl/babl.h index 4032faa..04bc00a 100644 --- a/babl/babl.h +++ b/babl/babl.h @@ -713,6 +713,17 @@ const char * babl_format_get_encoding (const Babl *babl); int babl_space_is_cmyk (const Babl *space); int babl_space_is_gray (const Babl *space); +typedef void (*BablFishProcess) (const Babl *babl, const char *src, char *dst, long n, void *data); +/** + * babl_fish_get_dispatch: (skip) + * + * get the dispatch function of a fish, this allows faster use of a fish + * in a loop than the more indirect method of babl_process, this also avoids + * base-level instrumentation. + */ +BablFishProcess babl_fish_get_process (const Babl *babl); + + /* values below this are stored associated with this value, it should also be * used as a generic alpha zero epsilon in GEGL to keep the threshold effects * on one known value. diff --git a/export-symbols b/export-symbols index 420ef87..07b4e95 100644 --- a/export-symbols +++ b/export-symbols @@ -78,6 +78,7 @@ babl_conversion_class_for_each babl_set_extender babl_extension_quiet_log babl_fish_path +babl_fish_get_process babl_extender babl_class_name babl_sanity -- 2.30.2